#! /usr/bin/env python
# -*- coding:utf-8 -*-
# Author Jmz
from  socket import *

service = socket(AF_INET,SOCK_STREAM)

service.bind(('127.0.0.1',8981))

service.listen(5)

while True:
    conn,client_addr = service.accept()
    while True:
        try:
            msg = conn.recv(1024)
            if not msg:break
            data = msg.upper()
            conn.send(data)
        except Exception as e:
            print(client_addr)
            break
    conn.close()

service.close()